<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

	$query = new Doctrine_Query();
    $query->from('LkGlossary l')
    			->where('l.category_id = 221 OR l.item_id = 23 AND l.deleted = 0')
            	->orderby('l.item_name');
    $items = $query->execute();	
   
$dom = new DomDocument('1.0');
$dom->formatOutput = true;

$root = $dom->createElement( "results" );
$dom->appendChild( $root );

	foreach ($items as $item){
		$dn = $dom->createElement( "record" );
		$dn->setAttribute( 'data', $item['item_id'] );
		$dn->setAttribute( 'label', $item['item_name'] );
		$root->appendChild( $dn );
}		

header( "Content-type: text/xml");
echo $dom->saveXML();
    
?>